package com.rm.zeyou.mapper;

import com.rm.zeyou.entity.Notice;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 * 公告ID Mapper 接口
 * </p>
 *
 * @author YanYang
 * @since 2025-04-07 10:56:04
 */
@Mapper
public interface NoticeMapper extends BaseMapper<Notice> {

    @Select("SELECT COUNT(*) FROM t_notice WHERE FIND_IN_SET(#{userId},user_id) and id=#{noticeId} ")
    Integer selUserIsRead(@Param("userId") Long userId, @Param("noticeId") Long noticeId);

    @Update("update t_notice set user_id =  CONCAT(user_id,',',#{userId}) WHERE id=#{noticeId} ")
    Integer updateNotice(@Param("userId") Long userId, @Param("noticeId") Long noticeId);
    @Update("update t_notice set user_id =  #{userId} WHERE id=#{noticeId} ")
    Integer updateOneNotice(@Param("userId") Long userId,@Param("noticeId") Long noticeId);
}
